import { request } from 'umi';
//处理分户修改
export function UpdateDiviPro(date: string) {
  const data = new FormData();
  data.append('Date', date);
  return request(`/api/restricted/UpDiviProcess/Divi`, {
    method: 'POST',
    body: data,
  });
}
//更新追溯日期
export function UpdateZSRQ(day: number) {
  const data = new FormData();
  data.append('day', '' + day);
  return request(`/api/restricted/UpDiviProcess/UpdateZSRQ`, {
    method: 'POST',
    body: data,
  });
}

//保存认定关系
export function saveDivi(
  diviType: API.DiviType,
  acids: number[],
  dsdt: string,
  divis: Record<number, number>,
) {
  const data = new FormData();
  data.append('Acids', JSON.stringify(acids));
  data.append('Dsdt', dsdt);
  data.append('DiviMap', JSON.stringify(divis));
  return request(`/api/restricted/AccountDivi/${diviType}`, {
    method: 'POST',
    body: data,
  });
}

export function ygddFsChange(frid: number, ywlx: number, yjbd: string, islz: boolean) {
  const data = new FormData();
  data.append('ywlx', '' + ywlx);
  data.append('yjbd', '' + yjbd);
  data.append('islz', islz ? 'true' : 'false');
  return request(`/api/restricted/ygddFsChange/${frid}`, {
    method: 'POST',
    body: data,
  });
}
